﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using TiledLib;
using XnaPathfidingLibrary;


namespace darkeggs
{
    class light: Microsoft.Xna.Framework.Game

    {
        Vector2 position;
        Texture2D TEXTURE;
        string color;
        Vector2 dimensions = new Vector2(64,64);
        bool isActive = true;
        int health = 1;

        private XnaPathfidingLibrary.Map map;

        /// <summary>
        /// The search algorithm is derived from AbstractSearch. 
        /// </summary>
        private AbstractSearch searchComponent;

        /// <summary>
        /// Texture for navigable nodes.
        /// </summary>
        private Texture2D navigableTexture;

        /// <summary>
        /// Texture for non navigable nodes.
        /// </summary>
        private Texture2D nonNavigableTexture;

        /// Texture for the start node.
        /// </summary>
        private Texture2D startTexture;

        /// <summary>
        /// Texture for the start end.
        /// </summary>
        private Texture2D endTexture;

        
        public light(Texture2D texAug, Vector2 posAug, string colorAug)
        {
            TEXTURE = texAug;
            position = posAug;
            color = colorAug;

        }

                public void update(TileLayer details)
        {
            //use case info
            //Tile tile = tileLayer.Tiles[temp.X, temp.Y];
                
            //implement pathfinding
        }

        public void draw(SpriteBatch sb)
        {
            Vector2 temp = new Vector2( (position.X - dimensions.X/2),(position.Y - dimensions.Y/2));
            sb.Draw(TEXTURE,temp,Color.White);
        }

        public void hit(int damage)
        {
            health -= damage;
            if (health <= 0)
                isActive = false;
        }

        public bool isAlive()
        {
            return isActive;
        }

        public Vector2 getPos()
        {
            return position;
        }

        map = new XnaPathfidingLibrary.Map(40,24);

        // The top left cell is the start node. 
            // Change it if you want another node. Remember the first value is line and the second is column.
            map.StartNode = map.Nodes[0, 0];
            // The botton right cell is the end node.
            // Change it if you want another node. Remember the first value is line and the second is column.
            map.EndNode = map.Nodes[29, 39];
    }
}
